package com.weixing.mall.util;

import cn.hutool.core.date.DateTime;

public class CommodityCode {

    public  static  String  creatCode(){
        DateTime dd=new DateTime();
        String  dateString=dd.toDateStr().replaceAll("-","");
        String  dateTime=dd.toTimeStr().replaceAll(":","");;
        StringBuffer buffer=new StringBuffer();
        buffer.append("GN");
        for(int i=0;i<dateString.length();i++){
            buffer.append(dateString.substring(i,i+1));
            if(	i<dateTime.length()){
                buffer.append(dateTime.substring(i,i+1));
            }else{
                buffer.append((int)Math.random()*10);
            }

        }
        return buffer.toString();
    }
}
